package cn.tedu._03vehicle.base.interceptors;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerInterceptor;

import java.time.LocalDateTime;

@Slf4j
public class TimeAccessInterceptor implements HandlerInterceptor {


//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        log.debug("开始限制请求时间6-22：59");
//
//        LocalDateTime now = LocalDateTime.now();
//        if (now.getHour() < 6 || now.getHour() > 22) {
////           response.sendRedirect("/time-restricted.html");
//            throw new RuntimeException("当前时间不允许访问");
//        }
//        return true;
//    }
}
